/**
 * Copyright (c) 2012 Nokia Corporation. 
 */

package com.nokia.example.tictactoe.ui;

import java.io.IOException;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

/**
 * An informative label on top of the game view.
 */
public class InfoLabel extends TextLabel {
	// Members
	private Image _backgroundImage = null;
	
	/**
	 * Constructor.
	 * @param text The initial text of the label.
	 */
	public InfoLabel(int width, int height) {
		super(width, height);
		setTextColor(0xffffffff);
		
		try {
			_backgroundImage = Image.createImage("/graphics/label-bg.png");	
		}
		catch (IOException e) {	}		
	}
	
	/**
	 * From CanvasGraphicsItem->TextLabel. 
	 */
	protected void paint(Graphics graphics) {
		if (_text != null) {
			if (_backgroundImage != null) {
				graphics.drawImage(_backgroundImage, 0, 0, Graphics.TOP | Graphics.LEFT);
			}
			
			super.paint(graphics);
		}
	}
}
